/**
*      author: Y_Yao
*      created: 2024-09-18 23:11:47
**/

#include<bits/stdc++.h>

using namespace std;
void solve()
{
    double l,r;
    cin >> l >> r;
    int an = (int)(sqrt((r - l)*2+(1.0/4.0)) - 1.0/2.0);
    cout << an + 1 <<endl; 
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}